package com.kmis.controllers;

import com.kmis.entities.User;
import com.kmis.utils.JwtUtil;
import com.kmis.vo.UserVo;
import com.kmis.web.ApiResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author moc
 */
@RestController
public class LoginController {
    @PostMapping("/login")
    public ApiResult login(@RequestBody UserVo user){
        String token = JwtUtil.genJwtToken(user.getUsername());
        return ApiResult.ok("成功").put("token", token);
    }

}
